name: Main

on:
  push:
    branches: [main]
    paths-ignore:
      - "*.md"
      - ".github/**"

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Setup .NET
        uses: actions/setup-dotnet@v1
        with:
          dotnet-version: 7.0.x
      - name: Build
        run: dotnet build -c Release
      - name: Test
        run: dotnet test -c Release
      - name: Publish
        run: dotnet publish -c Release
      - name: Push to Nuget
        env:
          NUGET_TOKEN: ${{secrets.NUGET_TOKEN}}
        run: dotnet nuget push --api-key $NUGET_TOKEN --source https://api.nuget.org/v3/index.json ./src/AutoRegisterInject/bin/Release/*.nupkg